package com.atom.common.pojo.mapper;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author zr
 * @description 文件类型
 * file: '.doc,.docx,.xls,.xlsx,.ppt,.pptx,.wps,.pdf',
 * img: '.png,.jpg,.jpeg,.bmp,.gif,.svg,.ico',
 * radio: '.mpeg,.mp3,.wav',
 * video: '.mp4,.rmvb,.avi,.mkv,.wmv'
 * @date 2021/12/20
 */
@Getter
@AllArgsConstructor
public enum FileType implements DbEnum {

	FOLDER(1, "文件夹"),
	IMG(2, "图片"),
	VIDEO(3, "视频"),
	AUDIO(4, "音乐"),
	DOCUMENT(5, "文档"),
	OTHER(6, "其他");

	public final static Integer FileTypeDictCode = 100;

	private final Integer code;
	private final String display;

	/**
	 * 获取匹配的枚举值
	 * @param code 编码
	 * @return 返回匹配的枚举值
	 */
	public static FileType match(Integer code) {
		if (code == null) {
			return null;
		}
		for (FileType fileType : values()) {
			if (fileType.getCode().equals(code)) {
				return fileType;
			}
		}
		return null;
	}
}
